package com.xrz.sxm.aj.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.xrz.sxm.aj.activity.R;
import com.xrz.sxm.aj.entity_tab.Xwmxb;
import com.xrz.sxm.aj.utils.Utils;

import joanzapata.android.BaseAdapterHelper;
import joanzapata.android.QuickAdapter;

/**
 * Created by Administrator on 2016/9/5.
 */
public class XueweiPicAdapter extends QuickAdapter<Xwmxb>{
	private TextView tv_empty;
	public XueweiPicAdapter(Context context, TextView tv_empty) {
		super(context, R.layout.item_picgridview);
		this.tv_empty = tv_empty;
	}

	@Override
	protected void convert(BaseAdapterHelper helper, Xwmxb xwmxb) {
		ImageView imageview = helper.getView(R.id.imageview);
		imageview.setImageResource(Utils.getImageByPicName(xwmxb.tmlj));
		helper.setText(R.id.tv_name, xwmxb.xwmc);
	}

	@Override
	public void notifyDataSetChanged() {
		super.notifyDataSetChanged();
		if(getCount() == 0){
			tv_empty.setVisibility(View.VISIBLE);
		}else{
			tv_empty.setVisibility(View.GONE);
		}
	}
}
